package com.csx.governance.traffic.condition.config;

import com.csx.governance.traffic.condition.Component;
import com.csx.governance.traffic.condition.ComponentFactory;
import com.csx.governance.traffic.condition.LogicComponent;
import com.csx.governance.traffic.condition.support.CompareExpressionComponent;
import com.csx.governance.traffic.condition.support.ExcludeExpressionComponent;
import com.csx.governance.traffic.condition.support.IncludeExpressionComponent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author cuisongxu
 * @date 2023/2/25 17:58
 */
@Configuration
public class TrafficGovernanceConditionAutoConfiguration {

    @Bean
    public ComponentFactory componentFactory(List<Component.Builder> builders) {
        return new ComponentFactory(builders);
    }

    @Bean
    public Component.Builder logicComponentBuilder() {
        return new LogicComponent.Builder();
    }

    @Bean
    public Component.Builder compareExpressionComponentBuilder() {
        return new CompareExpressionComponent.Builder();
    }

    @Bean
    public Component.Builder includeExpressionComponentBuilder() {
        return new IncludeExpressionComponent.Builder();
    }

    @Bean
    public Component.Builder excludeExpressionComponentBuilder() {
        return new ExcludeExpressionComponent.Builder();
    }

}
